# encoding: utf-8

#
#  BlogEntryView.py
#  AseanWeb
#
#  Created by nakanishi on 09/04/23.
#  Copyright (c) 2009 CMScom. All rights reserved.
#

from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.interface import implements
from Products.CMFCore.utils import getToolByName
from DateTime import DateTime

class BlogEntryView(BrowserView):
    __call__ = ViewPageTemplateFile('BlogEntryView.pt')
    
    def trans_pub_date(self,time):
        """get pub date"""
        tool = getToolByName(self, 'portal_languages', None)
        bound = tool.getLanguageBindings()
        lang = bound[0]
        if not isinstance(time, DateTime):
            time=DateTime(time)
        if lang == 'ja':
            vTimeStr = '%s年%s月%s日' % (time.year(),time.month(),time.day())
        else:
            vTimeStr = '%s-%s-%s' % (time.year(),time.month(),time.day())
        return vTimeStr